load("pairData.Rda")


##############################################
## 2d DP pairwise comparison model
##############################################
library(MCMCpack)
set.seed(5819)
I <- length(unique(pairData$respondent))
J <- length(unique(c(pairData$statementID1, pairData$statementID2)))
gamma.start <- rep(pi/4,I)#runif(I)*pi/2
gamma.start <- runif(I, pi/4-.4, pi/4+.4) 
theta.start <- matrix(0, 42, 2)
theta.start[15,1] <- 0.25  ## statement 1015
theta.start[15,2] <- 0.25  ## statement 1015
theta.start[4,1] <- -1    ## statement 1004
theta.start[42,1] <- 1    ## statement 1042

out.2dDP <- MCMCpaircompare2dDP(pairData,
                                theta.constraints=list('1015' = list(1, 0.25),
                                                      '1015' = list(2, "+"),
                                                       
                                                       '1004' = list(1, "-"),
                                                       '1042' = list(1, "+")
                                                       ),  
                                verbose=1000, burnin=40000, mcmc=400000,
                                thin=40,
                                seed = 84001,
                                gamma.start=gamma.start,
                                alpha = 1,
                                cluster.max=250,
                                cluster.mcmc=50,
                                alpha.fixed=FALSE,
                                a0=1, b0=1,
                                theta.start=theta.start,
                                store.theta=TRUE, store.gamma=TRUE,
                                tune=.08, procrustes=FALSE) 

save(out.2dDP, file="out-2dDP-nofraud-balanced-newIDs.Rda")

